home *** CD-ROM | disk | FTP | other *** search
- Path: newsbf02.news.aol.com!not-for-mail
- From: asciizero@aol.com (ASCII zero)
- Newsgroups: comp.lang.c
- Subject: I can't print the date in the format I want.
- Date: 17 Feb 1996 18:11:43 -0500
- Organization: America Online, Inc. (1-800-827-6364)
- Sender: root@newsbf02.news.aol.com
- Message-ID: <4g5nbf$8s0@newsbf02.news.aol.com>
- Reply-To: asciizero@aol.com (ASCII zero)
- NNTP-Posting-Host: newsbf02.mail.aol.com
-
- Hi! It is I once again.
-
- I am trying to use strftime() to format the date into YY-MM-DD. The format
- seems to be working but I am unable to actually print the formatted
- string. It compiles just fine using gcc. What have I overlooked?
-
- #include <stdio.h>
- #include <time.h>
-
- main()
- {
-
- struct tm *ptr;
- time_t lt;
- char *str;
- int debug; /* inserted for debugging purposes */
-
- lt = time(NULL);
- ptr = localtime(<);
- printf("\n The system clock shows: %s\n\n", asctime(ptr));
- debug = strftime(str, 50, "The current date is %y-%m-%d", ptr);
- printf("-> %i", debug); /* can we get the length of the
- formatted string? */
- getchar(); /* OK up to this point? */
- printf("%s", str);
-
- }
-
-
- Please help. Thanks. -jj
-
- asciizero@aol.com(J.J. Cariaso)
-